
package com.scalar.chiptrack.users;

import java.util.ArrayList;
import java.util.HashMap;

import javax.servlet.http.HttpSession;

import com.scalar.chiptrack.commons.SessionKeys;


public class Functionality {

    // ENGINEERING FUNCTIONALITIES
    public static final String ENGINEERING_PULL     = "Engineering Pull";
    public static final String ENGINEERING_RETURN   = "Engineering Return";
    public static final String SCRAP                = "Scrap";
    public static final String HOLD_LOTS            = "Hold Lots";
    public static final String ENGINEERING_REPORTS  = "Engineering Reports";
    public static final String ENGG_PULL_REPORT     = "Engineering Pull Report";
    public static final String ENGG_SCRAP_REPORT    = "Engineering Scrap Report";
    public static final String YIELD_REPORTS        = "Yield Reports";
    public static final String VENDOR_REPORT        = "Vendor Report";
    public static final String CYCLE_TIME_GRAPH_REPORT = "Cycle Time Graph Report";
    public static final String YIELD_GRAPH_REPORT   = "Yield Graph Report";


    // OPERATION FUNCTIONALITIES
    public static final String PRODUCT                = "Product";
    public static final String PRODUCT_SETUP          = "Product Setup";
    public static final String PROCESS_TYPE_SETUP     = "Process Type Setup";
    public static final String PRODUCT_SUBSTITUTABLES = "Product Substitutables";
    public static final String BOM_PART_ENTRY         = "BOM Part Entry";
    public static final String BOM_SETUP              = "BOM Setup";
    public static final String GROUP_FAB_STAGES       = "Group Fab Stages";
    public static final String GROUP_ASSEMBLY_STAGES  = "Group Assembly Stages";
    public static final String MRB_BIN_SETUP          = "MRB Bin Setup";

    public static final String PROCESS_VIEW         = "Process View";
    public static final String PRODUCT_AVAILABILITY = "Product Availability";
    public static final String TRACING              = "Lot Tracing";

    public static final String PACKING_SLIP         = "Packing Slip";
    public static final String PRO_FORMA_INVOICE    = "Pro-Forma Invoice";
    public static final String VENDOR_DETAILS       = "Vendor Details";
    public static final String ORDER_SCHEDULING     = "Order Scheduling";
    public static final String LOT_SHIPPING         = "Lot Shipping";
    public static final String SPLIT_MERGE_LOTS     = "Split/Merge Lots";
    public static final String DOCUMENTATION        = "Documentation";
    public static final String DATA_ENTRY           = "Data Entry";
    public static final String DATA_ENTRY_LOTS      = "Data Entry Lots";
	public static final String FAB_DATA_ENTRY           = "Fab Data Entry";
	public static final String SORT_DATA_ENTRY           = "Sort Data Entry";
	public static final String ASSEMBLY_DATA_ENTRY       = "Assembly Data Entry";
	public static final String TEST_DATA_ENTRY           = "Test Data Entry";
	public static final String INVENTORY_DATA_ENTRY      = "Inventory Data Entry";
	public static final String TRANSIT_DATA_ENTRY        = "Transit Data Entry";
	public static final String SCRAP_DATA_ENTRY        = "Scrap Data Entry";
	public static final String TRANSFER_MATERIAL        = "Transfer Material";
    public static final String EXTERNAL_DATA_ENTRY  = "External Data Entry";
    public static final String OP_APPROVAL_RIGHTS   = "Operations Holds/Release";
    public static final String BOARD_INVENTORY      = "Board Inventory";
    public static final String BOARD_KIT_MAKING     = "Board or Kit Making";
    public static final String MATERIAL_REQUEST     = "Material Requisition";
    public static final String COMMERCIAL_INVOICE   = "Commercial Invoice";
    public static final String PCM_DATA		        = "PCM Data";
    public static final String FAB_RELEASE     		= "Fab Release";
    public static final String ASSEMBLY_RELEASE     = "Assembly Release";
    public static final String SORT_RELEASE	        = "Sort Release";
    public static final String PROGRAMMING_RELEASE	= "Programming Release";
    public static final String TEST_RELEASE	        = "Test Release";
    public static final String TAPE_REEL_REQUEST    = "Tape Reel Request";
    
    public static final String LOT_CORRECTION	    = "Lot Correction";
    public static final String ASSEMBLY_BIN_SETUP	= "Assembly Bin Setup";
    public static final String FINISHEDGOODS_SETUP  = "Finished Goods Setup";
    public static final String SPECIFICATION_FILE_SETUP = "Specification File Setup";
    public static final String RELEASE_INFO_SETUP   = "Release Info Setup";
    public static final String MASS_UPDATE  = "Mass Update";

    public static final String APPROVE_PROGRAMMING_RELEASE = "Approve Programming Release";
    public static final String SHIP_PROGRAMMING_RELEASE = "Ship Programming Release";
    public static final String CANCEL_PROGRAMMING_RELEASE  = "Cancel Programming Release";
    public static final String FGI_SHIP_LOTS        = "FGI Ship Lots";
    public static final String RELEASE_LOTS      	  = "Release Lots";
    public static final String BOM_INVENTORY = "BOM Inventory";
    public static final String FGI_RECEIPTS = "FGI Receipts";
    public static final String MRB_RELEASE  = "MRB Release";
    public static final String APPROVE_SORT_RELEASE = "Approve Sort Release";
    public static final String APPROVE_ASSEMBLY_RELEASE = "Approve Assembly Release";
    public static final String APPROVE_TEST_RELEASE = "Approve Test Release";
    
    public static final String OPERATIONS_DATA_DUMP_REPORTS = "Operations Data Dump Reports";
    public static final String SORT_DATA_DUMP_REPORT = "Sort Data Dump Report";
    public static final String ASSEMBLY_DATA_DUMP_REPORT = "Assembly Data Dump Report";
    public static final String TRANSACTION_DATA_DUMP_REPORT = "Transaction Data Dump Report";
    public static final String WIP_FLUSH_SETUP = "Wip Flush Setup";
    public static final String SORT_TRANSACTION_DATA_DUMP_REPORT = "Sort Transaction Data Dump Report";
    public static final String ASSEMBLY_TRANSACTION_DATA_DUMP_REPORT = "Assembly Transaction Data Dump Report";
    public static final String PACKING_SLIP_INVENTORY = "Packing Slip Inventory";
    public static final String RUN_ADAPTOR = "Run Adaptor";
    public static final String STAGE_CYCLE_TIME_SETUP="Stage Cycle Time Setup";
    public static final String DISTRIBUTOR_SALES_ORDER = "Distributor Sales Order";

    // Operations Reports
    public static final String OPERATIONS_REPORTS       = "Operations Reports";
    public static final String WIP_INVENTORY_INFO       = "Wip/Inventory Info";
    public static final String WIP_FLUSH    	        = "Wip Flush";
    public static final String WIP_INVENTORY_VS_BACKLOG = "Wip/Inventory Vs Backlog";
    public static final String SHIPMENT_REPORT_BY_DATE  = "Shipment Report by date";
    public static final String LOT_INTRANSIT            = "Lot InTransit";
    public static final String INVENTORY_SUMMARY_REPORT = "Inventory Summary Report";
    public static final String RUN_ADAPTORS             = "Run adaptors";
    public static final String BOM_REPORT               = "BOM Report";
    public static final String RELEASE_REPORTS          = "Release Reports";
    public static final String DISTRIBUTOR_REPORT       = "Distributor Report";
    public static final String PRODUCT_DETAILS_REPORT   = "Product Details Report";
    public static final String BOARD_KIT_INVENTORY_REPORT   = "Board/Kit Inventory Report";
    public static final String BOARD_KIT_INVENTORY_SUMMARY_REPORT   = "Board/Kit Inventory Summary Report";
    public static final String PLANNING_REPORT                  = "Planning Report";
    public static final String BINNING_INFO_REPORTS             = "Binning Info Reports";
    public static final String PRODUCTION_REPORT                = "Production Report";
    public static final String PRODUCTION_REPORT_BY_MONTH       = "Production Report By Month";
    public static final String TRANSACTION_REPORT               = "Transaction Report";
    public static final String ASSEMBLY_INSTRUCTION_REPORT      = "Assembly Instruction Report";

    public static final String EXTERNAL_WIP_INVENTORY_INFO      = "External Wip/Inventory Info";
    public static final String WAFER_START_REPORT               = "Wafer Start Report";
    public static final String SPECIFICATION_FILE_REPORT        = "Specification File Report";
    public static final String LEFT_TO_BOOK_REPORT              = "Left To Book Report";
    public static final String RMA_RECEIVE_REPORT               = "RMA Receive Report";
    public static final String RECEIVE_LOT_REPORT               = "Receive Lot Report";
    public static final String OPENPO_PPV_IPV_REPORT            = "Open PO PPV IPV Report";

    // not used links
    public static final String DIE_BANK_REPORT          = "Die Bank Report";
    public static final String WAFER_SORT_DETAILS       = "Wafer Sort Details";
    public static final String LOTS_PROJECTION_REPORTS  = "Lots Projection Reports";
    public static final String SORT_CLOSED_LOT_REPORT   = "Sort Closed Lot Report";
    public static final String MRB_WAFERS_REPORT        = "MRB Wafers Report";
    public static final String VENDOR_INVENTORY_REPORT  = "Vendor Inventory Report";
    public static final String SCRAP_LOTS_REPORT        = "Scrap Lots Report";

    // MARKETING FUNCTIONALITIES
    public static final String PRICE_SETTING              = "Price Setting/Reference";

    public static final String SETTING_SALES_FORECAST     = "Setting Sales Forecast";
    public static final String SETTING_MARKETING_FORECAST = "Setting Marketing Forecast";

    public static final String SETTING_FORECAST           = "Setting Forecast";
    public static final String FORECAST_SETUP             = "Forecast Setup";
    public static final String PROJECT_SETUP              = "Project Setup";
    public static final String SALES_PERSON_SETUP         = "Sales Person Setup";
    public static final String SALES_FORECAST             = "Sales Forecast";
    public static final String BUILD_FORECAST             = "Build Forecast";
    public static final String MARKETING_STANDARD_PRICING = "Marketing Standard Pricing";
    public static final String MARKETING_CUSTOMER_PRICING = "Marketing Customer Pricing";
    public static final String MARKETING_VIEW_PRICING     = "Marketing View Pricing";
    public static final String MARKETING_APPROVAL_RIGHTS  = "Marketing Holds/Release";
    public static final String MARKETING_QUARTER_PRICING  = "Marketing Quarter Pricing";
    public static final String PRICE_SETUP_UPLOAD         = "Marketing Price Setup Uplaod";
    public static final String SYSTEM_PREFERENCES         = "System Preferences";
    public static final String FORECAST_ENTRY_FOR_ALL_SALES_PERSONS = "Forecast Entry For All Sales Persons";
    public static final String SALES_FORECAST_UPLOAD_FILE = "Sales Forecast Upload File";
    public static final String BOARD_KIT_MANAGEMENT         = "Board Kit Management";
    public static final String BOARD_KIT_PACKING_SLIP       = "Board Kit Packing Slip";
    public static final String SAMPLE_BOOKING_REPORT        = "Sample Booking Report";
    public static final String SAMPLE_BACKLOG_REPORT        = "Sample Backlog Report";
    public static final String SAMPLE_SHIPMENT_REPORT       = "Sample Shipment Report";
    public static final String SAMPLE_PACKING_SLIP          = "Sample Packing Slip";
    public static final String BOARD_INVENTORY_DATA_ENTRY   = "Board Inventory Data Entry";


    // Marketing Reports
    public static final String MARKETING_REPORTS          = "Marketing Reports";
    public static final String FORECAST_REPORTS           = "Forecast Reports";
    public static final String PROJECT_REPORT             = "Project Report";
    public static final String BOARD_KIT_SHIPMENT_REPORT  = "Board/Kit Shipment Report";
    // Unused links in Marketing
    public static final String MARKETING_FORECAST_REPORT  = "Marketing Forecast Report";
    public static final String MARKETING_PRICE_REPORT     = "Marketing Price Report";

    // FINANCE FUNCTIONALITIES
    public static final String PO_INFORMATION                 = "PO Information";
    public static final String UPDATE_VIEW_COST               = "Update/View Cost";
    public static final String FINANCE_PO_ORDER_ENTRY         = "Finance PO Order Entry";
    public static final String FINANCE_PENDING_PURCHASE_ORDER = "Finance Pending Purchase Order";
    public static final String FINANCE_VIEW_PURCHASE_ORDER    = "Finance View Purchase Order";
    public static final String FINANCE_APPROVAL_RIGHTS        = "Finance Holds/Release";
    public static final String CREDIT_DEBIT_NOTE              = "Credit/Debit Note";
    public static final String APPROVE_CREDIT_DEBIT_NOTE      = "Approve Credit/Debit Note";
    public static final String COST_CODES_SETUP               = "Cost Codes Setup";
    public static final String COST_CODES_MASTER              = "Cost Codes Master";

    //Finanace Reports
    public static final String FINANCE_REPORTS                = "Finance Reports";
    public static final String FINANCE_REVENUE_REPORT         = "Finance Revenue Report";    
    public static final String FINANCE_COST_REPORTS           = "Finance Cost Reports";
    public static final String FINANCE_STANDART_COST_REPORT   = "Finance Standard Cost Report";
    public static final String FINANCE_DETAIL_COST_REPORT     = "Finance Detail Cost Report";
    public static final String FINANCE_REVENUE_SUMMARY_REPORT = "Finance Revenue Summary Report";
    public static final String FINANCE_VERTICAL_REPORT        = "Finance Vertical Report";
    public static final String FINANCE_CREDIT_NOTE_REPORT     = "Finance Credit/Debit Note Report";
    public static final String FINANCE_DIRECT_MARGIN_REPORT   = "Finance Direct Margin Report";
    public static final String FINANCE_COST_VARIANCE_REPORT   = "Finance Cost Variance Report";
    public static final String FINANCE_ACCRUED_LIABILITY_REPORT   = "Finance Accrued Liability Report";

   // Unused links in Finance
    public static final String FINANCE_WIP_COST_REPORT        = "Finance Wip Cost Report";
    public static final String FINANCE_INVENTORY_REPORT       = "Finance Inventory Report";
    public static final String FINANCE_REPORT_COST_REPORT     = "Finance Product Cost report";
    public static final String FINANCE_OVERHEAD_COST_REPORT   = "Finance Overhead Cost Report";
    public static final String FINANCE_VENDOR_REPORTS         = "Finance Vendor Reports";

    // SALES FUNCTIONALITIES
    public static final String SALES_ORDERS              = "Sales Orders";
    public static final String CUSTOMER_DETAILS          = "Customer Details";
    public static final String SAMPLES                   = "Samples";
    public static final String SALES_NEW_SALES_ORDER     = "Sales New Sales Order";
    public static final String SALES_CHANGE_ORDER        = "Sales Change Order";
    public static final String SALES_PENDING_ORDER       = "Sales Pending Order";
    public static final String SALES_ONLINE_ORDER        = "Sales Online Order";
    public static final String SALES_MISSED_ORDER        = "Sales Missed Order";
    public static final String SALES_CANCELLED_ORDER     = "Sales Cancelled Order";

    //Bhaskar added this object/variable on 15 july 2003
    public static final String SALES_HOLDS_RELEASES      = "Sales Order Holds/Releases";
    public static final String SALES_HOLDS_RELEASE       = "Sales Holds/Release";
    public static final String FINANCE_HOLDS_RELEASE     = "Finance Holds/Release";
    public static final String MARKETING_HOLDS_RELEASE   = "Marketing Holds/Release";
    public static final String OPERATIONS_HOLDS_RELEASE  = "Operations Holds/Release";
    public static final String SALES_VIEW_ORDER          = "Sales View Order";
    public static final String SAMPLE_NEW_SAMPLE_ORDER   = "Sample New Sample Order";
    public static final String SAMPLE_CHANGE_ORDER       = "Sample Change Order";
    public static final String SAMPLE_PENDING_ORDER      = "Sample Pending Order";
    public static final String SAMPLE_MISSED_ORDER       = "Sample Missed Order";
    public static final String SAMPLE_CANCELLED_ORDER    = "Sample Cancelled Order";
    public static final String SAMPLE_VIEW_ORDER         = "Sample View Order";
    public static final String SALES_TAX_TERMS_SETUP     = "Sales Tax And Terms Setup";
    public static final String REASON_CODE_SETUP         = "Reason Codes Setup";
    public static final String SALES_APPROVAL_RIGHTS     = "Sales Holds/Release";
    public static final String SHIP_LOCATION_FOR_SO      = "Shipping Location for SO";

    //Sales Reports
    public static final String SALES_REPORTS                    = "Sales Reports";
    public static final String SALES_BOOKING_REPORTS            = "Sales Booking Reports";
    public static final String SALES_BACKLOG_REPORT             = "Sales Backlog Report";
    public static final String SALES_BBB_REPORT                 = "Sales BBB Report";
    public static final String SALES_PERFORMANCE_REPORT         = "Sales Performance Report";
    public static final String SAlES_SHIPPING_REPORT            = "Sales Shipping Report";
    public static final String SAlES_SHIPMENT_REPORT            = "Sales Shipment Report";
    public static final String SAlES_CUSTOMER_REPORT            = "Sales Customer Report";
    public static final String SAlES_INVOICE_REPORT             = "Sales Invoice Report";
    public static final String SAlES_PENDING_SHIPMENT_REPORT    = "Sales Pending Shipment Report";
    public static final String SAlES_VENDOR_SHIPMENT_REPORT     = "Sales Vendor Shipment Report";
    public static final String SAlES_SHIPMENT_REPORT_by_Lot_Number     = "Sales Shipment Report by Lot Number";
    public static final String SAlES_CRD_SCH_CHANGE_REPORT      = "Sales CRD/Sch Change Report";
    public static final String SAlES_ORDER_INFO_REPORT          = "Sales Order Info Report";

    public static final String SAlES_EXTERNAL_REPORTS                       = "Sales External Reports";
    public static final String SAlES_EXTERNAL_BACKLOG_REPORTS               = "Sales External Backlog Reports";
    public static final String SAlES_EXTERNAL_SHIPMENT_REPORTS              = "Sales External Shipment Reports";
    public static final String SAlES_EXTERNAL_VENDOR_SHIPMENT_REPORT        = "Sales External Vendor Shipment Report";
	public static final String EXTERNAL_PENDING_ORDERS_REPORT				= "External Pending Orders Report";
	public static final String SAlES_EXTERNAL_BOOKING_REPORTS				= "Sales External Booking Reports";
    public static final String QUOTATION_REPORT                 = "Quotation Report";

    //SALES UNUSED LINKS
    public static final String SALES_MISSED_ORDER_REPORT = "Sales Missed Order Report";

    //Added by Mallik Ankati 11/23/2004
    public static final String CUSTOMER_RELATIONSHIPS	 = "Customer Relationships";

    //Added by Mallik Ankati 01/31/2004
    public static final String RMA						 = "RMA";
    public static final String RMA_FORM					 = "RMA Form";
    public static final String RMA_LOG					 = "RMA Log";
    public static final String APPROVE_RMA  			 = "Approve RMA";




    //Basha added this variable on 02/04/2004
    public static final String SALES_NEW_QUOTATION  = "New Quotation";
    public static final String APPROVE_QUOTATION    = "Approve Quotation";
    public static final String CHANGE_QUOTATION     = "Change Quote";

    // ADMIN FUNCTIONALITIES
    public static final String MAINTAIN_USERS     = "Maintain Users";
    public static final String ADD_NEW_USER       = "Add New User";
    public static final String ACCESS_LEVEL_SETUP = "Access Level Setup";
    public static final String JOB_ADMINISTRATION = "Job Administration";
    public static final String NOTIFICATION_SETUP = "Notification Setup";

    public static final String SYSTEM_JOB_SETUP = "System Job Setup";
    public static final String ADAPTER_SETUP    = "Adaptor Setup";
    public static final String CONFIG_SETUP     = "Config Setup";
    public static final String COMPANY_CALENDAR = "Company Calendar";
    public static final String MAINTAIN_EXTERNAL_USERS = "Maintain External Users";
    public static final String USER_REPORTS     = "User Reports";
    public static final String COMPANY_SETUP     = "Company Setup";
    public static final String DISCREPENCY_LOT_NOTIFICATIONS     = "Discrepancy Lot Notifications";
    public static final String ACCOUNTS_SETUP     = "Accounts Setup";


    // Added By sharath on 5th Jan 04
    // Purchasse Order
    public static final String PURCHASE_ORDER           = "Purchase Order";
    public static final String RECEIVINGS_TRANSACTION   = "Receivings Transaction";
    public static final String PURCHASING_INVOICE       = "Purchasing Invoice";
    public static final String PURCHASE_ORDER_SETUP     = "Purchasing Order Setup";
    public static final String PURCHASE_ORDER_REPORTS   = "Purchase Order Reports";
    public static final String SALES_ORDER_INVOICE      = "Sales Order Invoice";

    public static final String CHANGE_PURCHASE_ORDER    = "Change Purchase Orders";
    public static final String APPROVE_PURCHASE_ORDER   = "Approve Purchase Orders";
    public static final String VIEW_PURCHASE_ORDER      = "View Purchase Orders";
    public static final String CANCELLED_PURCHASE_ORDER = "Cancelled Purchase Orders";
    public static final String SCRAP_MATERIAL  = "Scrap Material";

    public static final String EXTERNAL_FORECAST = "ExternalForecast";
    public static final String FORECAST_ANALYSIS = "Forecast Analysis";


    public Functionality() {
    }

    public Functionality (int id, String name, int groupId, boolean view, boolean modify, boolean delete) {
        m_id = id;
        m_name = name;
        m_groupId = groupId;
        m_view = view;
        m_modify = modify;
        m_delete = delete;
    }

    /**
     * ID Property
     */
    private int m_id = -1;

    public int getId() {
        return m_id;
    }
    public void setId (int id) {
        m_id = id;
    }

    /**
     * Name property
     */
    private String m_name = null;

    public String getName() {
        return m_name;
    }
    public void setName(String name) {
        m_name = name;
    }

    /**
     * Group ID Property
     */
    private int m_groupId = -1;

    public int getGroupId() {
        return m_groupId;
    }
    public void setGroupId (int groupId) {
        m_groupId = groupId;
    }


    /**
     * View Property
     */
    private boolean m_view = false;

    public boolean getView() {
        return m_view;
    }

    public void setView (boolean view) {
        m_view = view;
    }

    /**
     * Modify Property
     */
    private boolean m_modify = false;

    public boolean getModify() {
        return m_modify;
    }

    public void setModify (boolean modify) {
        m_modify = modify;
    }

    /**
     * Delete Property
     */
    private boolean m_delete = false;

    public boolean getDelete() {
        return m_delete;
    }

    public void setDelete (boolean delete) {
        m_delete = delete;
    }

    public static final ArrayList getSubLinksForParentLink( String linkName )
    {

        ArrayList subLinksList = new ArrayList();

        if ( linkName != null && linkName.equalsIgnoreCase( PRODUCT ))
        {
            subLinksList.add( PRODUCT_SETUP );
            subLinksList.add( PROCESS_TYPE_SETUP );
            subLinksList.add( BOM_PART_ENTRY );
            subLinksList.add( BOM_SETUP );
            subLinksList.add( GROUP_FAB_STAGES );
            subLinksList.add( ASSEMBLY_BIN_SETUP );
            subLinksList.add( MRB_BIN_SETUP );
            subLinksList.add( FINISHEDGOODS_SETUP );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( DATA_ENTRY ))
        {
            subLinksList.add( DATA_ENTRY );
            subLinksList.add( LOT_CORRECTION );
            subLinksList.add( BOM_INVENTORY );
            subLinksList.add( FGI_RECEIPTS );
            subLinksList.add( MRB_RELEASE );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( RELEASE_LOTS ))
        {
            subLinksList.add( SORT_RELEASE );
            subLinksList.add( ASSEMBLY_RELEASE );
            subLinksList.add( PROGRAMMING_RELEASE );
            subLinksList.add( RELEASE_INFO_SETUP );
            subLinksList.add( SPECIFICATION_FILE_SETUP );
            subLinksList.add( MASS_UPDATE );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( OPERATIONS_REPORTS ))
        {
            subLinksList.add( WIP_INVENTORY_INFO );
            subLinksList.add( WIP_FLUSH );
            subLinksList.add( WIP_INVENTORY_VS_BACKLOG );
            subLinksList.add( SHIPMENT_REPORT_BY_DATE);
            subLinksList.add( LOT_INTRANSIT );
            subLinksList.add( INVENTORY_SUMMARY_REPORT );
            subLinksList.add( RUN_ADAPTORS );
            subLinksList.add( BOM_REPORT );
            subLinksList.add( RELEASE_REPORTS );
            subLinksList.add( DISTRIBUTOR_REPORT );
            subLinksList.add( PRODUCT_DETAILS_REPORT );
            subLinksList.add( BOARD_KIT_INVENTORY_REPORT );
            subLinksList.add( BOARD_KIT_INVENTORY_SUMMARY_REPORT );
            subLinksList.add( PLANNING_REPORT );
            subLinksList.add( BINNING_INFO_REPORTS );
            subLinksList.add( PRODUCTION_REPORT );
            subLinksList.add( ASSEMBLY_INSTRUCTION_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( OPERATIONS_DATA_DUMP_REPORTS ))
        {
            subLinksList.add( SORT_DATA_DUMP_REPORT );
            subLinksList.add( ASSEMBLY_DATA_DUMP_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( ENGINEERING_REPORTS ))
        {
            subLinksList.add( YIELD_REPORTS );
            subLinksList.add( VENDOR_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( MARKETING_REPORTS ) )
        {
            subLinksList.add( FORECAST_REPORTS );
            subLinksList.add( PROJECT_REPORT );
            subLinksList.add( BOARD_KIT_SHIPMENT_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( FINANCE_REPORTS ) )
        {
            subLinksList.add( FINANCE_REVENUE_REPORT );
            subLinksList.add( FINANCE_COST_REPORTS );
            subLinksList.add( FINANCE_REVENUE_SUMMARY_REPORT );
            subLinksList.add( FINANCE_VERTICAL_REPORT );
            subLinksList.add( FINANCE_STANDART_COST_REPORT );
            subLinksList.add( FINANCE_DETAIL_COST_REPORT );                        
            subLinksList.add( FINANCE_CREDIT_NOTE_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( SALES_REPORTS ) )
        {
            subLinksList.add( SALES_BOOKING_REPORTS );
            subLinksList.add( SALES_BACKLOG_REPORT );
            subLinksList.add( SAlES_SHIPPING_REPORT );
            subLinksList.add( SALES_PERFORMANCE_REPORT );
            subLinksList.add( SAlES_SHIPMENT_REPORT );
            subLinksList.add( SAlES_CUSTOMER_REPORT );
            subLinksList.add( SAlES_PENDING_SHIPMENT_REPORT );
            subLinksList.add( SAlES_INVOICE_REPORT );
            subLinksList.add( SAlES_VENDOR_SHIPMENT_REPORT );
            subLinksList.add( SAlES_SHIPMENT_REPORT_by_Lot_Number );
            subLinksList.add( SAlES_CRD_SCH_CHANGE_REPORT );
            subLinksList.add( SAlES_ORDER_INFO_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( SAlES_EXTERNAL_REPORTS ) )
        {
            subLinksList.add( SAlES_EXTERNAL_BACKLOG_REPORTS );
            subLinksList.add( SAlES_EXTERNAL_SHIPMENT_REPORTS );
            subLinksList.add( SAlES_EXTERNAL_VENDOR_SHIPMENT_REPORT );
            subLinksList.add( EXTERNAL_WIP_INVENTORY_INFO );
			subLinksList.add( EXTERNAL_PENDING_ORDERS_REPORT );
            subLinksList.add( SAlES_EXTERNAL_BOOKING_REPORTS );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( EXTERNAL_FORECAST ) )
        {
            subLinksList.add( PROJECT_SETUP );
            subLinksList.add( SALES_PERSON_SETUP );
            subLinksList.add( SALES_FORECAST );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( BOARD_KIT_MANAGEMENT ) )
        {

            subLinksList.add( SAMPLE_BOOKING_REPORT );
            subLinksList.add( SAMPLE_BACKLOG_REPORT );
            subLinksList.add( SAMPLE_SHIPMENT_REPORT );
            subLinksList.add( SAMPLE_PACKING_SLIP );
            subLinksList.add( BOARD_KIT_INVENTORY_REPORT );
        }
        else if ( linkName != null && linkName.equalsIgnoreCase( EXTERNAL_DATA_ENTRY ) )
        {
            subLinksList.add( DATA_ENTRY );
        }

        return subLinksList;
    }

    public static final boolean enableParentLink( String linkName, HttpSession session )
    {
        boolean showLink = false;
        ArrayList subLinksList = null;
        User user = null;
        HashMap functionAccessMap = null;
        String functionName = null;
        FunctionAccess functionAccess = null;


        if ( linkName != null )
        {
            subLinksList = getSubLinksForParentLink( linkName );
        }

        if ( subLinksList != null && subLinksList.size() > 0 )
        {
            user = (User)session.getAttribute( SessionKeys.USER_KEY );
            functionAccessMap = user.getFunctionAccessMap();

            for(int i=0; i < subLinksList.size(); i++)
            {
                functionName = (String)subLinksList.get(i);
                functionAccess = (FunctionAccess)functionAccessMap.get( functionName.toLowerCase() );

                if ( functionAccess != null && ( functionAccess.getView() || functionAccess.getModify() || functionAccess.getDelete() ) )
                {
                    showLink = true;
                    break;
                }
            }
        }

        return showLink;
    }

}